<link rel="stylesheet" href="assets/common/plugins/umeditor/themes/default/css/umeditor.css">
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
                <input type="hidden" name="category[pq_pid]" value="{{$info['pq_pid']}}" />
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl" style="color:#F00;font-weight:bold;">修改问题</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">问题标题 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="category[pq_question]"  value="{{$info['pq_question']}}" required>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">问题类型 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="category[pq_type]" value="1" <?php if($info['pq_type']==1) echo 'checked'; ?>> 单选题
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="category[pq_type]" value="2"  <?php if($info['pq_type']==2) echo 'checked'; ?>> 多选题
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="category[pq_type]" value="3"  <?php if($info['pq_type']==3) echo 'checked'; ?>> 填空题
                                    </label>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">正确答案 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="category[pq_right]"
                                           value="{{$info['pq_right']}}" required>
                                    <small>如：2，第二个答案正确。如：2，4表示第二第四为多选正确答案</small>
                                </div>
                            </div>

                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"></label>
                                <div class="am-u-sm-9 am-u-end" style="display: flex;">
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top am-u-sm-6" style="width:100%;">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label">问题描述 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <textarea id="pq_info" name="category[pq_info]" >{{$info['pq_info']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top am-u-sm-6" style="width:100%;">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label">解题思路 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <textarea id="pq_thought" name="category[pq_thought]" >{{$info['pq_thought']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"></label>
                                <div class="am-u-sm-9 am-u-end" style="display: flex;">
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">图文答案1 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <!-- 加载编辑器的容器 -->
                                                <textarea id="pq_ask1" name="category[pq_ask1]" type="text/plain">{{$info['pq_ask1']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">图文答案2 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <!-- 加载编辑器的容器 -->
                                                <textarea id="pq_ask2" name="category[pq_ask2]" type="text/plain">{{$info['pq_ask2']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"></label>
                                <div class="am-u-sm-9 am-u-end" style="display: flex;">
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">图文答案3 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <!-- 加载编辑器的容器 -->
                                                <textarea id="pq_ask3" name="category[pq_ask3]" type="text/plain">{{$info['pq_ask3']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">图文答案4 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <!-- 加载编辑器的容器 -->
                                                <textarea id="pq_ask4" name="category[pq_ask4]" type="text/plain">{{$info['pq_ask4']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"></label>
                                <div class="am-u-sm-9 am-u-end" style="display: flex;">
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label ">图文答案5 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <!-- 加载编辑器的容器 -->
                                                <textarea id="pq_ask5" name="category[pq_ask5]" type="text/plain">{{$info['pq_ask5']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div style="flex:1;">
                                        <div class="am-form-group am-padding-top">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label ">图文答案6 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <!-- 加载编辑器的容器 -->
                                                <textarea id="pq_ask6" name="category[pq_ask6]" type="text/plain">{{$info['pq_ask6']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">排序 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="number" class="tpl-form-input" name="category[pq_sort]"
                                           value="{{$info['pq_sort']}}" required>
                                    <small>数字越小越靠前</small>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">状态 </label>
                                <div class="am-u-sm-9 am-u-end">
                                <label class="am-radio-inline">
                                    <input type="radio" name="category[pq_show]" value="1"  <?php if($info['pq_show']==1) echo 'checked'; ?> > 显示
                                </label>
                                <label class="am-radio-inline">
                                    <input type="radio" name="category[pq_show]" value="2" <?php if($info['pq_show']==2) echo 'checked'; ?>> 隐藏
                                </label>
                                </div>
                            </div>

<!--                            <div class="am-form-group">-->
<!--                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">回答次数 </label>-->
<!--                                <div class="am-u-sm-9 am-u-end">-->
<!--                                    <input type="number" class="tpl-form-input" name="category[pq_usenum]"-->
<!--                                           value="{{$info['pq_usenum']}}" required>-->
<!--                                    <small>该问题被回答的次数</small>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                            <div class="am-form-group">-->
<!--                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">正确次数 </label>-->
<!--                                <div class="am-u-sm-9 am-u-end">-->
<!--                                    <input type="number" class="tpl-form-input" name="category[pq_rightnum]"-->
<!--                                           value="{{$info['pq_rightnum']}}" required>-->
<!--                                    <small>该问题回答正确的次数</small>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                            <div class="am-form-group">-->
<!--                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">错误次数 </label>-->
<!--                                <div class="am-u-sm-9 am-u-end">-->
<!--                                    <input type="number" class="tpl-form-input" name="category[pq_errornum]"-->
<!--                                           value="{{$info['pq_errornum']}}" required>-->
<!--                                    <small>该问题回答错误的次数</small>-->
<!--                                </div>-->
<!--                            </div>-->

                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary" style="background:#FF0000;padding-left:50px;padding-right:50px;border-color:#FF0000;">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 图片文件列表模板 -->
<script id="tpl-file-item" type="text/template">
    {{ each list }}
    <div class="file-item">
        <a href="{{ $value.file_path }}" title="点击查看大图" target="_blank">
            <img src="{{ $value.file_path }}">
        </a>
        <input type="hidden" name="{{ name }}" value="{{ $value.file_id }}">
        <i class="iconfont icon-shanchu file-item-delete"></i>
    </div>
    {{ /each }}
</script>
<!-- 图片文件列表模板 -->
{{include file="layouts/_template/tpl_file_item" /}}

<!-- 文件库弹窗 -->
{{include file="layouts/_template/file_library" /}}
<script src="assets/common/plugins/umeditor/umeditor.config.js?v=<?= $version ?>"></script>
<script src="assets/common/plugins/umeditor/umeditor.min.js"></script>
<script>
    $(function () {

        // 选择图片
        $('.upload-file').selectImages({
            name: 'category[image_id]'
        });

        // 富文本编辑器
        UM.getEditor('pq_ask1', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });
        UM.getEditor('pq_ask2', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });
        UM.getEditor('pq_ask3', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });
        UM.getEditor('pq_ask4', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });
        UM.getEditor('pq_ask5', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });
        UM.getEditor('pq_ask6', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });
        UM.getEditor('pq_thought', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });

        UM.getEditor('pq_info', {
            initialFrameWidth: 375 + 15,
            initialFrameHeight: 600
        });

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });
</script>
